﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript" type="text/javascript" src="<%=path%>/My97DatePicker/WdatePicker.js"/></script>
<script language="javascript" type="text/javascript" src="<%=path%>/js/jquery-1.9.1.min.js"/></script>
<script>
	function admintree(){
		var res=window.showModalDialog('<%=basePath%>/tree.jsp',window,'dialogWidth:300px;dialogHeight:500px;status:no;directories:yes;scrollbars:no;help=no;');
		if(res!=undefined){
			var adminshow=res.split('&')[0]
			var ids=res.split('&')[1]
			document.getElementById('adminshow').value=adminshow;
			document.getElementById('area_id').value=ids[0];
        }
	}
	
	$(function(){
		//$('#dis1').hide();//初始隐藏落户信息table
		//$('#dis2').hide();//初始隐藏落户信息table
		//页面下拉菜单动态获取
		//$('#carType').prepend("<option value=''>===请选择===</option>");
		//$('#managLevel').prepend("<option value=''>===请选择===</option>");
		$.post(
			"<%=path%>/ajax/findDicByType.action", 
			{
				dicType: 'DIC_CARTYPE,DIC_SECURITYPROTECTION,DIC_SETTLE,DIC_MANAGLEVEL,DIC_SOURCEMODE,DIC_USETYPE,DIC_COLOR'
			},
			function(json){
				var obj = $.parseJSON(json);
				$.each(obj.dicList,function(commentIndex, comment) {
					var dictype=comment.dictype;
					if(dictype=='DIC_CARTYPE'){
						$('#carType').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
					if(dictype=='DIC_SETTLE'){
						$('#settle').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
					if(dictype=='DIC_SECURITYPROTECTION'){
						$('#securityProtectionTD').append("<input type='checkbox' name='carinformitionVo.securityprotection' id='securityprotection' value='"+comment.dicvalue+"'>"+comment.dicname+"</input>");
					}
					if(dictype=='DIC_MANAGLEVEL'){
						$('#managLevel').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
					if(dictype=='DIC_SOURCEMODE'){
						$('#sourcemode').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
					if(dictype=='DIC_USETYPE'){
						$('#usetype').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
					if(dictype=='DIC_COLOR'){
						$('#color').append("<option value='"+comment.dicvalue+"'>"+comment.dicname+"</option>");
					}
				})
				$('#settle').change(function(){
					if ('1'==$(this).children('option:selected').val()) {
						$('#dis1').show();
						$('#dis2').show();
					} else if ('2'==$(this).children('option:selected').val()) {
						$('#plateNumber').val('');
						$('#yearlyInspection').val('');
						$('#forceInsurance').val('');
						//("[name='checkbox']").removeAttr("checked");
						//$('#mobilephone').attr('disabled',true);
						$('#dis1').hide();
						$('#dis2').hide();
					} 
				})
			},"text"
		);
	});
	
	function check(){
		var carType=$('#carType').val();
		var plateNumber=$('#plateNumber').val();
		var serialNumber=$('#serialNumber').val();
		
		if($('#username').val()==''){
			alert('请输入姓名')
			return false;
		}else if($('#idcard').val()==''){
			alert('请输入身份证号')
			return false;
		}else if($('#mobilephone').val()==''&&$('#telephone').val()==''){
			alert('请输入手机号或者固定电话号')
			return false;
		}else if($('#adminshow').val()==''){
			alert('请选择所有人的行政管辖')
			return false;
		}else if(carType==''){
			alert('请选择车辆类型')
			return false;
		}else if(serialNumber==''){
			alert('请输入车辆识别码')
			return false;
		}else if('2'==$('#settle').children('option:selected').val()){
			if(plateNumber==''){
				alert('请输入车牌号码')
				return false;
			}
		}
		$('#addForm')[0].submit();
	}
	var msg="${requestScope.rMsg}";
	if(msg!=""){
		alert(msg);
	}
</script>
<title>Insert title here</title>
<link href="<%=basePath%>/images/css.css" rel="stylesheet" type="text/css">
</head>

<body class="bg_003">
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="201" height="30" align="center" background="<%=basePath%>/images/016.jpg"><table width="75%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="25"> <img src="<%=basePath%>/images/1.png" width="16" height="16"></td>
        <td><strong>综合信息采集</strong></td>
      </tr>
    </table></td>
    <td align="right" background="<%=basePath%>/images/017.jpg" class="zi_006">信息采集</td>
    <td width="39"><img src="<%=basePath%>/images/018.jpg" width="39" height="30"></td>
  </tr>
</table>
<form id="addForm" name="addForm" action="<%=path %>/messagecollection/addCarinformition.action" method="post">
<input type='hidden' id='securityProtectionHidden' name='carinformitionVo.securityprotection'/>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1" bgcolor="#e1e1e2"></td>
        <td height="298" align="center">
        <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#e1e1e1">
          <tr>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>姓名：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="carinformitionVo.name" type="text" id="username" size="14">
            </td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>身份证号：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="carinformitionVo.idcard" type="text" id="idcard" size="21">
            </td>
            <td width="16%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>行政管辖：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="adminshow" type="text" id="adminshow" size="14" readonly='readonly' disabled>
            	<input name="carinformitionVo.area_id" type="hidden" id="area_id" size="14">
            	<input type="button" id="checkOtherBtn" value="选择" onclick='admintree()'>
            </td>
          </tr>
          <tr>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>移动电话：</td>
           	<td width="22%" height="31" align="left" bgcolor="#f5f5f5">
           		<input name="carinformitionVo.mobilephone" type="text" id="mobilephone" size="14">
           	</td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5">固定电话：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="carinformitionVo.telephone" type="text" id="telephone" size="14">
            </td>
          	<td width="10%" height="31" align="right" bgcolor="#f5f5f5">车辆获取方式：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5">
            <select name="carinformitionVo.sourcemode" id="sourcemode">
            </select></td>
          </tr>
          <tr>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5">居住地：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5" colspan="5">
            	<input name="carinformitionVo.address" type="text" id="address" size="80">
            </td>
          </tr>
           <tr>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>车辆类型：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5">
            	<select name="carinformitionVo.cartype" id="carType"></select>
            </td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>车辆识别码：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.serialnumber" type="text" id="serialNumber" size="14"></td>
            <td width="16%" height="31" align="right" bgcolor="#f5f5f5">核定人数：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.number" type="text" id="number" size="14" onkeyup="this.value = this.value.replace(/\D/g,'');"></td>
          </tr>
          <tr>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5">车色：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5">
            	<select name="carinformitionVo.color" id="color"></select>
            </td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5">管理级别：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            <select name="carinformitionVo.managlevel" id="managLevel"></select></td>
            <td width="16%" height="31" align="right" bgcolor="#f5f5f5">品牌型号：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            	<input name="carinformitionVo.platetype" type="text" id="textfield3" size="14">
            </td>
          </tr>
          <tr>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5">购车时间：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.buytime" type="text" id="buyTime" size="14" onFocus="WdatePicker({el:this,dateFmt:'yyyy年MM月dd日',maxDate:'#F{\'%y-%M\'}'})"></td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5">使用类型：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
            	<select name="carinformitionVo.usetype" id="usetype"></select>
            </td>
            <td width="16%" height="31" align="right" bgcolor="#f5f5f5">落户：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5">
				<select name="settle" id="settle"></select>
			</td>
          </tr>
          
          
          <tr id='dis1'>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5"><font color='red'>*</font>车辆号牌：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.platenumber" type="text" id="plateNumber" size="14" value="黑M"></td>
            <td width="12%" height="31" align="right" bgcolor="#f5f5f5">年检时间：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.yearlyinspection" type="text" id="yearlyInspection" size="14" onFocus="WdatePicker({el:this,dateFmt:'yyyy年'})"></td>
            <td width="16%" height="31" align="right" bgcolor="#f5f5f5">交强险到期时间：</td>
            <td width="20%" height="31" align="left" bgcolor="#f5f5f5"><input name="carinformitionVo.forceinsurance" type="text" id="forceInsurance" size="14" onFocus="WdatePicker({el:this,dateFmt:'yyyy年'})"></td>
          </tr>
          <tr id='dis2'>
            <td width="10%" height="31" align="right" bgcolor="#f5f5f5">安全防护：</td>
            <td width="22%" height="31" align="left" bgcolor="#f5f5f5" id="securityProtectionTD" colspan="6"></td>
          </tr>
        </table>
          <table width="95%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td height="50" align="center"><input type="button" id="subbutton" value=" 提 交 " onclick="check()"></td>
            </tr>
          </table></td>
        <td width="1" bgcolor="#e1e1e2"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="5" height="5"><img src="<%=basePath%>/images/019.jpg" width="5" height="5"></td>
        <td width="100%" height="5" class="bg_002"></td>
        <td width="5" height="5"><img src="<%=basePath%>/images/020.jpg" width="5" height="5"></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<table width="603" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="26">&nbsp;</td>
  </tr>
</table>
</body>

</html>